<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/admin.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery.blockUI.js"></script>
<script>
function openEditForm(id, start, end) {
	$("#id").val(id);
	var str = start.split(":");
	$("#startHour").val(str[0]);
	$("#startMin").val(str[1]);
	str = end.split(":");
	$("#endHour").val(str[0]);
	$("#endMin").val(str[1]);
	$.blockUI({ message: $('#editForm') });
}
$(document).ready(function() { 
	$('.closePopup').click(function() { 
		$.unblockUI();
	});
	$('#btnSubmit').click(function() { 
		$("#configUpdate").submit();
	});
	
});
</script>

<div id="editForm" style="display:none;">
<s:form id="configUpdate" action="configUpdate">
<s:hidden id="id" name="id"></s:hidden>
	<div class="popupTitle"><a class="closePopup" href="#"><img src="<%= request.getContextPath() %>/images/close.png" /></a></div>
	<div class="popupContent">
		Giờ bắt đầu: <s:select id="startHour" name="startHour" list="hourList" /> 
		phút <s:select id="startMin" name="startMin" list="minList" /> <br/>
		Giờ kết thúc: <s:select id="endHour" name="endHour" list="hourList" /> 
		phút <s:select id="endMin" name="endMin" list="minList" /> <br/>
		<input type="button" id="btnSubmit" value="Cập nhật" />
		<input type="button" class="closePopup" value="Hủy bỏ" />
	</div>
</s:form>
</div>

<div>
	<a href="search.action">Cài đặt giờ làm việc</a> | 
	<a href="configManager.action">Quản lý cấu hình</a> | 
	<a href="accountManager.action">Quản lý account</a> |
	<a href="report.action">Xem báo cáo</a> | 
</div>
<div class="configTime">
	<table>
		<tr>
			<td><b>Ngày</b></td>
			<td><b>Giờ bắt đầu</b></td>
			<td><b>Giờ kết thúc</b></td>
			<td><b>Thao tác</b></td>
		<tr>
		<s:iterator value="workTimeList" status="workTime">
		<tr>
			<td><s:property value="name"/></td>
			<td><s:property value="start"/></td>
			<td><s:property value="end"/></td>
			<td><a href="#" onclick="openEditForm(<s:property value="id" />,'<s:property value="start"/>','<s:property value="end"/>')"><img src="<%= request.getContextPath() %>/images/edit.png" /></a></td>
		</tr>
		</s:iterator>
	</table>
</div>